<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <a href="/storehome/" class="button">返回</a>
    <title>发货处理</title>
</head>
<body>
    <h1>发货处理</h1>
    {% if messages %}
        <ul class="messages">
            {% for message in messages %}
                <li {% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
            {% endfor %}
        </ul>
    {% endif %}
    <form action="/logistics/" method="post">
        {% csrf_token %}
        <button type="submit" name="action" value="2">查询未处理订单</button>
        <button type="submit" name="action" value="4">查询所有订单</button>
        <div class="container mt-5">
            <h2>处理发货信息</h2>
            <form action="/store/" method="post">
                {% csrf_token %}
                <div class="mb-3">
                    <label for="id_email" class="form-label">订单号</label>
                    {{ form.orderid.errors }}
                    {{ form.orderid }}
                </div>
            </form>
            <button type="submit" name="action" value="3">发货</button>
        </div>
    </form>
    {% if backend_message %}
        {% for x in backend_message %}
            <p>
                <strong>订单号:</strong> {{ x.id }}
                <strong>订单状态:</strong> {{ x.status }}
                {% if x.tracking_number %}
                    <strong>物流单号:</strong> {{ x.tracking_number }}
                {% endif %}
            </p>
        {% endfor %}
    {% else %}
        <p>订单未找到。</p>
    {% endif %}
</body>
</html>

